package com.maas.hesap;

public class Test {
	public static void main(String[] args) {
		Calisan[] calisans = new Calisan[7];
		calisans[0] = new Sekreter();
		calisans[1] = new Teknisyen();
		calisans[2] = new Teknisyen();
		calisans[3] = new Teknisyen();
		calisans[4] = new Teknisyen();
		calisans[5] = new Muhendis();
		calisans[6] = new Muhendis();

		maasHesaplaGoster(calisans);

		Sekreter sekreter = new Sekreter();
		Teknisyen teknisyen = new Teknisyen();
		Muhendis muhendis = new Muhendis();

		maasHesapla(sekreter, 1);
		maasHesapla(teknisyen, 4);
		maasHesapla(muhendis, 2);

		System.out.println("Maas : " + maas);
		System.out.println("Mesai : " + mesai);
		System.out.println("Toplam : " + (maas + mesai));
	}

	private static void maasHesaplaGoster(Calisan[] calisans) {
		double maas = 0;
		double mesai = 0;
		for (Calisan calisan : calisans) {
			maas += calisan.getMaas();
			mesai += calisan.getMesai();
		}

		System.out.println("Maas : " + maas);
		System.out.println("Mesai : " + mesai);
		System.out.println("Toplam : " + (maas + mesai));

	}

	static double maas = 0;
	static double mesai = 0;

	private static void maasHesapla(Calisan calisan, int personelSayisi) {

		maas += (calisan.getMaas() * personelSayisi);
		mesai += (calisan.getMesai() * personelSayisi);

	}

}
